@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@using MeiluluSqlite.DataMode;
@{
    List<MyMoney> data = (List<MyMoney>)ViewData["data"];
    string id = ViewData["id"].ToString();
    double max = 0;
    for (int i = 0; i < data.Count; i++)
    {
        max += data[i].value;
    }
}

<script type="text/javascript">
    window.onload = function () {
        document.getElementById("all").innerHTML = @max;
    }
    function deldata(id) {
        $.ajax({
            type: "post",
            url: "/Money/Deldata",
            data: { "id": id },
            success: function (data) {
                alert(data);
            },
            error: function (err) { alert(err); }
        });
    }
</script>

<form>
    <div>
        <input type="text" value="@id" id="id" name="id" />
        <input type="text" value="non" id="classname" name="classname" />
        <input type="submit" value="查" />
    </div>
</form>
<p id="all"></p>
<div>
    <table class="table">
        <thead>
            <tr>
                <th>时间</th>
                <th>类型</th>
                <th>值</th>
                <th>备注</th>
                <th>删除</th>
            </tr>
        </thead>
        <tbody id="bbddyy">
            @for (int i = 0; i < data.Count; i++)
            {
               
            <tr>
                <td>
                    @data[i].changeTime
                </td>
                <td>
                    @if (data[i].type == 0)
                    {
                        <span>支出</span>
                    }
                    else
                    {
                        <span>收入</span>
                    }
                </td>
                <td>
                    @data[i].value
                </td>
                <td>
                    @data[i].remarks
                </td>
                <td>
                    <span onclick="deldata('@data[i].id')"> 删除</span>
                </td>
            </tr>
            }
        </tbody>
    </table>
</div>